package com.itheima.controller;


import com.itheima.pojo.Result;
import com.itheima.utils.JwtUtil;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/article")
public class ArticleController {

    @GetMapping("/list")

    public Result<MysqlxDatatypes.Scalar.String> list(/*@RequestHeader(name = "Authorization") String token , HttpServletResponse response*/){
        /*token验证*/
/*        try {
            Map<String, Object> claims = JwtUtil.parseToken(token);
            *//*token校验成功*//*
            return Result.success("所有的文章数据");
        } catch (Exception e) {
            *//*到catch这边表示token校验失败*//*
            *//*http响应状态码为401*//*
            response.setStatus(401);
            return Result.error("未登录");
        }*/

        return Result.success("所有的文章数据");

    }

}
